import request from '@/utils/request'

export function fetchList(query) {
  return request({
    url: '/admin/order',
    method: 'get',
    params: query
  })
}

export function fetchShow(id) {
  return request({
    url: '/admin/order/' + id + '/edit',
    method: 'get'
  })
}

export function fetchStore(data) {
  return request({
    url: '/admin/order',
    method: 'post',
    data
  })
}

export function fetchUpdate(id, data) {
  return request({
    url: '/admin/order/' + id,
    method: 'put',
    data
  })
}

export function fetchDelete(id) {
  return request({
    url: '/admin/order/' + id,
    method: 'delete'
  })
}

export function fetchBatchDelete(data) {
  return request({
    url: '/admin/order/0',
    method: 'delete',
    data
  })
}

export function fetchUpdateRemark(id, data) {
  return request({
    url: '/admin/order-remark/' + id,
    method: 'put',
    data
  })
}

export function fetchHold(id, data) {
  return request({
    url: '/admin/order-hold/' + id,
    method: 'post'
  })
}

export function fetchResume(id, data) {
  return request({
    url: '/admin/order-resume/' + id,
    method: 'post'
  })
}

export function fetchOrderVoid(id, data) {
  return request({
    url: '/admin/order-void/' + id,
    method: 'post'
  })
}

export function fetchUpdateOrderGroup(id, data) {
  return request({
    url: '/admin/order-group/' + id,
    method: 'put',
    data
  })
}

export function fetchUpdatePaymentRemark(id, data) {
  return request({
    url: '/admin/order-remark/' + id,
    method: 'put',
    data
  })
}

export function fetchOrderEmail(id, data) {
  return request({
    url: '/admin/order-email/' + id,
    method: 'post',
    data
  })
}

export function fetchUpdateOrder(id, data) {
  return request({
    url: '/admin/order/' + id,
    method: 'put',
    data
  })
}

export function fetchPaytype() {
  return request({
    url: 'admin/paytype-all',
    method: 'get'
  })
}

export function fetchSyncAx(query) {
  return request({
    url: 'admin/search-sync-ax',
    method: 'get',
    params: query
  })
}

export function fetchPostSyncAx(data) {
  return request({
    url: 'admin/create-sync-ax',
    method: 'post',
    data
  })
}
